package com.cetc28.c4isr.knowledge.controller;

import com.cetc28.c4isr.knowledge.bean.Relation;
import com.cetc28.c4isr.knowledge.bean.Vertex;
import com.cetc28.c4isr.knowledge.service.RelationService;
import com.cetc28.c4isr.knowledge.service.VertexService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController //里面包含@ResponseBody @Controller
public class HelloWorldController {

    private final VertexService vertexService;

    private final RelationService relationService;

    @RequestMapping(value = "hello")
    public String hello(){
        return "Hello World planedit!";
    }

    @RequestMapping(value = "getPlans")
    public String getPlans(@RequestParam(defaultValue = "") String pname){
        
        return pname;
    }

    @RequestMapping(value = "getAllVertex")
    public List<Vertex> getAllVertex(){
        return vertexService.getAllVertex();
    }

    @RequestMapping(value = "getAllRelation")
    public List<Relation> getAllRelation(){
        return relationService.getAllRelation();
    }


    @Autowired
    public HelloWorldController(VertexService vertexService,RelationService relationService){
        this.vertexService = vertexService;
        this.relationService = relationService;
    }



}
